from Strategy.CTPStrategy import CTPStrategy

class TestStratey(CTPStrategy):
    def __init__(self, name, params={}):
        super().__init__()
        self._name = name
        self._params = params
        self._provider = None
        self._positions = {}
        self._orders = []

    def OnStrategyStart(self):
        realPositions = self._provider.GetPosition()
        for p in realPositions:
            #convert
            pass

    def OnTick(self, data):
        print(self._name + " " + str(data))


    def Buy(self, symbol, qty):
        order = self._provider.Buy(symbol, qty)
        self._orders.append(order)

    def onOrderChange(self, data):
        self._positions = {}

